
<div class="layui-header header header-demo">
  <div class="layui-main">
    <div class="admin-logo-box">
      <a class="logo" href="#" title="logo">layui_php项目</a>
    </div>
    <div class="larry-side-menu" style="border: 0px solid red;position:absolute;top:15px;left:200px">
      <i class="fa fa-th-large" aria-hidden="false"></i>
    </div>
    <ul class="layui-nav layui-layout-left layui-ygyd-menu" style="">
      {foreach $menulist as $key=>$vo }
      <li class="layui-nav-item">
        <a href="javascript:;">
          <i class="layui-icon {$vo.icon} layui-anim layui-anim-rotate" style="top: 2px;font-size: 20px;"></i>
          <cite>{$vo.title}</cite>
        </a>
        <dl class="layui-nav-child">
          {foreach name="$vo['child']" item="subvo"}
          <dd>
            <a href="javascript:addTab('{$subvo[\'id\']}','{$subvo[\'title\']}','{:url($subvo.name)}','{$subvo[\'icon\']}');">
              <i class="layui-icon {$subvo.icon}" style="font-size: 15px;"></i><cite>{$subvo[\'title\']}</cite>
            </a>
          </dd>
          {/foreach}
        </dl>
      </li>
      {/foreach}
      <!--<li class="layui-nav-item">-->
      <!--    <a href="javascript:;"><i class="layui-icon">&#xe607;</i><cite>订单管理</cite></a>-->
      <!--    <dl class="layui-nav-child">-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">角色管理</a></dd>-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">权限设置</a></dd>-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">日志管理</a></dd>-->
      <!--    </dl>-->
      <!--</li>-->
      <!--<li class="layui-nav-item">-->
      <!--    <a href="javascript:;"><i class="layui-icon">&#xe62d;</i><cite>统计报表</cite></a>-->
      <!--    <dl class="layui-nav-child">-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">角色管理</a></dd>-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">权限设置</a></dd>-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">日志管理</a></dd>-->
      <!--    </dl>-->
      <!--</li>-->
      <!--<li class="layui-nav-item">-->
      <!--    <a href="javascript:;"><i class="layui-icon">&#xe614;</i><cite>系统管理</cite></a>-->
      <!--    <dl class="layui-nav-child">-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">角色管理</a></dd>-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">权限设置</a></dd>-->
      <!--        <dd><a href="javascript:addTab('dingdanguanli','订单管理','{:url(\'User/index/\')}');">日志管理</a></dd>-->
      <!--    </dl>-->
      <!--</li>-->
    </ul>
    <ul class="layui-nav" lay-filter="">
      <li class="layui-nav-item">
        <a onclick="popupRight('/admin/public/message','消息中心')" title="消息">
          <i class="layui-icon" style="top: 1px;">&#xe63a;</i>
        </a>
      </li>
      <li class="layui-nav-item">
        <a href="#" title="其他" class="layui-anim layui-anim-rotate layui-anim-loop">
          <img src="__STATIC__/images/logo.png" class="layui-circle" style="border: 2px solid #A9B7B7;" width="20px" alt="">
        </a>
      </li>
      <li class="layui-nav-item layui-hide-xs" lay-unselect>
        <a href="javascript:;" layadmin-event="fullscreen" onclick="fullscreen()">
          <i class="layui-icon layui-icon-screen-full"></i>
        </a>
      </li>
      <li class="layui-nav-item x-index">
        <a href="javascript:void(0)" style="width: 70px;border:0px solid red">{$Think.session.sysuser.account}</a>
        <dl class="layui-nav-child">
          <dd>
            <a href="javascript:userInfoFun();">个人信息</a>
          </dd>
          <dd>
            <a href="javascript:sysInfoFun(true);">实用插件</a>
          </dd>
          <dd>
            <a href="javascript:sysInfoFun();">系统信息</a>
          </dd>
          <dd>
            <a href="javascript:logoutFun(true);">退出系统</a>
          </dd>
        </dl>
      </li>
      <!-- <li class="layui-nav-item"> <a href="javascript:;">注销</a>
          <dl class="layui-nav-child">
              <dd><a href="javascript:sysInfoFun();">系统信息</a></dd>
              <dd><a href="javascript:logoutFun(true);">退出系统</a></dd>
          </dl>
      </li> -->
    </ul>
  </div>
</div>

<script>
  function logoutFun(b) {
    $.getJSON('{:url("Public/logout")}', function (result) {
      if (b) {
        location.replace('{:url("Index/index")}');
      } else {
        $('#sessionInfoDiv').html('');
        $('#user_login_loginDialog').dialog('open');
        $('#layout_east_onlineDatagrid').datagrid('load', {});
      }
    });
  }

  function userInfoFun() {
    $.get('{:url("/admin/Public/userInfo")}', {}, function (str) {
      layer.open({
        type: 1,
        anim: 1,
        //offset: 't',
        area: ['800px', '400px'],
        fix: false, //不固定
        maxmin: true,
        shadeClose: true,
        title: "编辑",
        content: str, //注意，如果str是object，那么需要字符拼接。
        btn: ['保存'],
        yes: function (index, layero) {
          //按钮【按钮一】的回调
          //console.log(index);
          //console.log(layero);
          var data=$("#user_userInfo_form").serializeObject();
          if(data.password==""){
            layer.msg('请输入新的密码！否则点击右上角关闭！');
            return false;
          }
          $.ajax({
            async:true,//默认true为异步
            url: '{:url("/admin/Public/userInfo")}',
            type: "post",
            data: data,
            dataType: "json",
            success: function (res,status,xhr) {
              if (res.code == 1) {
                layer.close(index);
                layer.msg(res.msg);
              } else {
                layer.msg("更新失败");
              }
            },
            error: function (xhr,status,error) {

            }
          });
        },
        cancel: function (index) {
          //右上角关闭回调
          layer.close(index);
          //return false 开启该代码可禁止点击该按钮关闭
        },
        success: function (layero, index) {
          //console.log(layero, index);
          //fillForm($("#Admin_User_Edit"), data);
        }
      });
    });
  }

  function sysInfoFun() {
    $.post('{:url("Public/main")}', {}, function (str) {
      layer.open({
        type: 2,
        anim: 4,
        //offset: 't',
        area: ['700px', '650px'],
        fix: false, //不固定
        maxmin: true,
        shadeClose: true,
        title: "系统信息",
        content: str, //注意，如果str是object，那么需要字符拼接。
      });
    });
  }
</script>